<!DOCTYPE html>
<html>

	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
		<meta id="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" name="viewport">
		<meta name="apple-themes-web-app-capable" content="yes">
		<meta content="yes" name="apple-mobile-web-app-capable">
		<meta content="black" name="apple-mobile-web-app-status-bar-style">
		<meta content="telephone=no" name="format-detection">
		<meta content="email=no" name="format-detection">
		<meta name="format-detection" content="telephone=no">
		<title>个人资料</title>	
		<link rel="stylesheet" href="${s.base}/mobile/css/main.css" type="text/css" media="all">
		<style type="text/css">
			/***图片上传***/
			.famous-upload-pic{display:block; text-align: left; position: relative; margin: 14px auto; padding-bottom:40px; width: 105px;
				height: 105px;
			}
			.famous-upload-pic .upload-avatar{display: block; width: 105px; height: 105px; margin-top: 14px;}
			.famous-upload-pic .upload{width: 105px; height: 105px; opacity: 0; position: absolute; top: 0;}
			.famous-upload-pic .desc{font-size: 1.2rem; color: #666;}
		</style>
	</head>

	<body>
		<header id="header">
			<div class="header_con">
				<a href="${s.base}/phone/mySet?memberId=${memberId}"><span></span></a>
                <div class="top_tit">
					<#if type=='1'>
						昵称修改
					</#if>
					<#if type=='2'>
						手机号修改
					</#if>
					<#if type=='3'>
						头像修改
					</#if>
					<#if type=='4'>
						姓名修改
					</#if>
					<#if type=='5'>
						支付密码修改
					</#if>
					<#if type=='6'>
						银行卡号修改
					</#if>
					<#if type=='7'>
						支付宝账号修改
					</#if>
					<#if type=='8'>
						微信账号修改
					</#if>
					<#if type=='9'>
						头像修改
					</#if>
				</div>
			</div>
		</header>

		<div id="content_div">
			<input type="hidden" id="type" value="${type}"/>
			<input type="hidden" id="memberId" value="${memberId}"/>
			<input type="hidden" id="id" value="${member.id}"/>
			<div class="pay_02" <#if type!='1'>style="display: none;"</#if>>
              <p class="border_bottom">昵称 <span><input type="text" value="${member.nickName}" id="nickName" style="width: 100%;height: 0.8rem;line-height: 0.8rem;border: 0px; text-align: right;margin-bottom:2px;" placeholder="请输入昵称" /></span></p>
		    </div>
			<div class="pay_02" <#if type!='2'>style="display: none;"</#if>>
				<p class="border_bottom">手机号 <span><input type="text" value="${member.phone}" id="phone"  style="width: 100%;height: 0.8rem;line-height: 0.8rem;border: 0px; text-align: right;margin-bottom:2px;" placeholder="请输入手机号" /></span></p>
			</div>
			<div class="pay_02" <#if type!='3'>style="display: none;"</#if>>
				<p class="border_bottom">头像 <span><input type="text"  style="width: 100%;height: 0.8rem;line-height: 0.8rem;border: 0px; text-align: right;margin-bottom:2px;" placeholder="请输入昵称" /></span></p>
			</div>
			<div class="pay_02" <#if type!='4'>style="display: none;"</#if>>
			<p class="border_bottom">姓名 <span><input type="text" value="${member.name}" id="name" style="width: 100%;height: 0.8rem;line-height: 0.8rem;border: 0px; text-align: right;margin-bottom:2px;" placeholder="请输入姓名" /></span></p>
			</div>

			<div class="pay_02" <#if type!='5'>style="display: none;"</#if>>
				<p class="border_bottom">支付密码 <span><input type="text" value="${member.payPassword}" id="payPassword" style="width: 100%;height: 0.8rem;line-height: 0.8rem;border: 0px; text-align: right;margin-bottom:2px;" placeholder="请输入支付密码" /></span></p>
			</div>

			<div class="pay_02" <#if type!='6'>style="display: none;"</#if>>
				<p class="border_bottom">银行卡 <span><input type="text" value="${member.bankCard}" id="bankCard" style="width: 100%;height: 0.8rem;line-height: 0.8rem;border: 0px; text-align: right;margin-bottom:2px;" placeholder="请输入银行卡" /></span></p>
			</div>

			<div class="pay_02" <#if type!='7'>style="display: none;"</#if>>
				<p class="border_bottom">支付宝账号 <span><input type="text" value="${member.alipay}" id="alipay" style="width: 100%;height: 0.8rem;line-height: 0.8rem;border: 0px; text-align: right;margin-bottom:2px;" placeholder="请输入支付宝账号" /></span></p>
			</div>
			<div class="pay_02" <#if type!='8'>style="display: none;"</#if>>
				<p class="border_bottom">微信账号 <span><input type="text" value="${member.weChat}" id="weChat" style="width: 100%;height: 0.8rem;line-height: 0.8rem;border: 0px; text-align: right;margin-bottom:2px;" placeholder="请输入微信账号" /></span></p>
			</div>
			<div class="pay_02" <#if type!='9'>style="display: none;"</#if>>
		<div class="layui-form-item layui-row layui-col-xs12">
			<label class="layui-form-label">头像</label>
			<div class="layui-input-block">
				<div class="famous-upload-pic">
					<img  src="${member.headImage}" class="upload-avatar" id="upload-avatar"/>
					<input type="file" name="myfiles" class="upload" id="myFile" onchange="ajaxFileUploads('myFile','headImage','upload-avatar')">
					<input type="hidden" class="headImage" id="headImage" value="${member.headImage}" />
				</div>
			</div>
		</div>

			</div>

		    <div class="pay_04 margin_top_1"><a class="ui-btn" onclick="saveOrUpdate()">立即修改</a></div>
      </div>	
            <!--底部-->
			<!--底部结束-->
		   
        <script type="text/javascript" src="${s.base}/mobile/js/jquery-1.7.2.min.js"></script>
		<script type="text/javascript" src="${s.base}/mobile/js/common.js"></script>
		<script type="text/javascript" src="${s.base}/js/layer/layer.js"></script>
		<script type="text/javascript" src="${s.base}/js/base/commont.js"></script>
		<script type="text/javascript" src="${s.base}/js/base/ajaxfileupload.js"></script>
		<script type="text/javascript">
            /**
             * 添加
             */
            function saveOrUpdate() {
                var memberId=$("#memberId").val();
                var type=$("#type").val();
                var id=$("#id").val();
                var name=$("#name").val();
                var phone=$("#phone").val();
                var nickName=$("#nickName").val();
                var payPassword=$("#payPassword").val();
                var bankCard=$("#bankCard").val();
                var weChat=$("#weChat").val();
                var alipay=$("#alipay").val();
                var headImage=$("#headImage").val();
                if (type=="4" && (name == null || ""==name)){
                    layer.alert("请输入姓名");
                    return false;
                }
                if (type=="2" && (phone == null || ""==phone)){
                    layer.alert("请输入手机号");
                    return false;
                }
                if (type=="1" && (nickName == null || ""==nickName)){
                    layer.alert("请输入昵称");
                    return false;
                }
                if (type=="7" && (alipay == null || ""==alipay)){
                    layer.alert("请输入支付宝账号");
                    return false;
                }
                if (type=="8" && (weChat == null || ""==weChat)){
                    layer.alert("请输入微信账号");
                    return false;
                }
                if (type=="9" && (headImage == null || ""==headImage)){
                    layer.alert("请选项头像");
                    return false;
                }

                $.ajax({
                    type: "POST",
                    url: "/phone/myUpdateNews?memberId="+memberId,
                    data: {"id":id,"name":name,"headImage":headImage,"nickName":nickName,"phone":phone,"bankCard":bankCard,"weChat":weChat,"alipay":alipay},
                    success: function(result){
                        if(1==result.returnInfo.state){
                            showLayerAlertNoRefre("修改成功");
                        }else{
                            showLayerAlertNoRefre(result.returnInfo.errorMsg);
                        }
                    },
                    error: function(result){
                        showLayerAlertNoRefre(result);
                    }
                });
            }

		</script>

	</body>

</html>